package com.qf.utils;

import org.apache.http.HttpHost;
import org.elasticsearch.client.Node;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

import java.util.ArrayList;

public class ConnectionUtils {
    public  static RestHighLevelClient getClient(){
        HttpHost httpHost = new HttpHost("baseservice.qfjava.cn",9078);
        Node node = new Node(httpHost);
//        ArrayList<Node> arrayList = new ArrayList<>();
//        arrayList.add(node);
//        RestClientBuilder clientBuilder = new RestClientBuilder(arrayList);
        RestClientBuilder clientBuilder = RestClient.builder(httpHost);
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(clientBuilder);
        return restHighLevelClient;
    }
}
